package com.andryu.grifika

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.LinearLayoutManager
import com.andryu.base.adapter.LearnListAdapter
import com.andryu.base.entity.LearnListEntity
import com.andryu.base.ui.fragment.BaseFragment
import com.andryu.grifika.databinding.FragmentGrifikaBinding
import dagger.hilt.android.AndroidEntryPoint
import javax.inject.Inject
import javax.inject.Named

@AndroidEntryPoint
class GrifikaFragment : BaseFragment() {


    private var _binding: FragmentGrifikaBinding?= null
    private val binding get() = _binding!!

    @Inject
    @Named("GrifikaList")
    lateinit var mDataList: MutableList<LearnListEntity>
    private lateinit var mAdapter: LearnListAdapter

    override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View {
        _binding = FragmentGrifikaBinding.inflate(inflater, container, false)
        return binding.root
    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        binding.rvGrifika.layoutManager = LinearLayoutManager(context)
        mAdapter = LearnListAdapter(mDataList)
        binding.rvGrifika.adapter = mAdapter
        mAdapter.setOnItemClick {

        }
    }

    override fun onDestroy() {
        super.onDestroy()
        _binding = null
    }
}